Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kraft): Introduce global CPU profiling env var #1865

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

nderjung
Copy link
Member

@nderjung nderjung commented Aug 26, 2024

This commit introduces the ability to enables Go's internal pprof module which samples the CPU. This allows developers to measure the performance of kraft itself and its associated call tree, allowing for performance debugging and optimization.

Simply set the environmental variable KRAFTKIT_CPU_PROFILE n any kraft invocation to the path to save the profile data, e.g.:

KRAFTKIT_CPU_PROFILE=./out.txt kraft [...]

Once the command has been completed, one can access the data using Go's internal tooling, e.g. via a web UI:

go tool pprof -http 0.0.0.0:8181 ./out.txt

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran make fmt on your commit series before opening this PR;
  • Updated relevant documentation.

Description of changes

This commit introduces the ability to enables Go's internal pprof
module which samples the CPU.  This allows developers to measure
the performance of `kraft` itself and its associated call tree,
allowing for performance debugging and optimization.

Simply set the environmental variable `KRAFTKIT_CPU_PROFILE`  on
any `kraft` invocation to the path to save the profile data, e.g.:

```
KRAFTKIT_CPU_PROFILE=./out.txt kraft [...]
```

Once the command has been completed, one can access the data using
Go's internal tooling, e.g. via a web UI:

```
go tool pprof -http 0.0.0.0:8181 ./out.txt
```

Signed-off-by: Alexander Jung <alex@unikraft.io>
Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good here. Thanks!

Reviewed-by: Cezar Craciunoiu cezar.craciunoiu@unikraft.io
Approved-by: Cezar Craciunoiu cezar.craciunoiu@unikraft.io

@craciunoiuc craciunoiuc merged commit c8f5da5 into unikraft:staging Aug 26, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants